perm filename DOC3[00,BGB] blob sn#098157 filedate 1974-04-24 generic text, type C, neo UTF8
COMMENT ⊗   VALID 00008 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002	1.0	INTRODUCTION TO GEOMES AND GEOMEL.
C00007 00003	2.0	MEMORY, CONTROL, INPUT AND OUTPUT ROUTINES.
C00010 00004	3.0 	DATUM AND LINK NAMES.
C00012 00005	4.0 	WINGED EDGE PRIMITIVES.
C00016 00006	5.0 	EULER ROUTINES.
C00017 00007	6.0	EUCLIDEAN TRANSFORMATIONS.
C00019 00008	7.0 	IMAGE FORMING ROUTINES.
C00021 ENDMK
C⊗;
1.0	INTRODUCTION TO GEOMES AND GEOMEL.

	GEOMED is implemented in PDP-10 machine  code and is composed
of  geometric modeling  subroutines. These  subroutines are  SAIL and
LISP accessible depending on how they are assembled and  loaded. When
assembled and load for SAIL, the GEOMED subroutines are called GEOMES
for  "Geometric Modeling  Embedded  in SAIL";  when the  routines are
assembled  and loaded  for  LISP,  they  are referred  to  as  GEOMEL
standing for "Geometric Modeling Embedded in LISP".

	Strictly  defined, I  would have  preferred to  use  the name
"GEOMED" only for the  editor itself and to  call the larger  project
"GEM" for Geometric Modeling; however this has  not caught on, and so
the reader  is warned that there are  two objects named "GEOMED", one
being the interactive drawing program  by that name, the other  being
the larger  geometric modeling project including  GEOMEL, GEOMES, the
data structures, the command languages, and so on.

	As  a graphics  language,   GEOMED is  all semantics  with no
syntax of its own. There are about one hundred  subroutines which take
from one to four arguments, return one or no values, and usually have
considerable side  effects  on  the data  structures.  Unless
otherwise noted,  all arguments and  values are integers; subroutines
executed only for effect tend to return integer value zero.

	The  GEOMED data  structure  is  implemented as  twelve  word
blocks containing pointers  and data in the fashion usual to graphics
and simulation; an  introduction to this technology  can be found  in
Knuth. The twelve word blocks  are called "nodes". Nodes are referred
to  by their actual machine address in  the user core image, which is
an integer called a "link". Subroutines that take  nodes as arguments
or  return  nodes  as   values  pass  links  rather  than  the  nodes
themselves.  In  SAIL,   the user  core image  can be  accessed as  a
special array named MEMORY.
2.0	MEMORY, CONTROL, INPUT AND OUTPUT ROUTINES.

QNODE	←	GEOMED;		Geometric Editor.
UNIVER	←	MKUNIV;		Make universe, initialization.
QNODE	←	MKNODE(QBITS);	Make node with given type bits.
ZERO	←	KLNODE(QNODE);	Kill node.

	THE routine  named GEOMED,  passes control  to the  geometric
editor,   which enters  the jump  table command scanner  discribed in
part I of this document. When the exit command "εE" is  given, GEOMED
returns the the address of the node  which is at the top of its stack
(or  zero,  if the stack is  empty).  MKUNIV; initializes GEOMED node
space.  QNODE  ← MKNODE(Q); takes  a node from  the empty node  list;
memory space is requested from SAIL or LISP as needed.  The integer Q
is stored in  the TYPE bits  (word zero) of  the newly created  node.
KLNODE(QNODE); returns a node to the empty node list.

ZERO	←	OUTB3D(FILENAME,BODY);
ZERO	←	OUTGEM(FILENAME,BODY);
BODY	←	INB3D(FILENAME);
BODY	←	INGEM(FILENAME);
3.0 	DATUM AND LINK NAMES.

Datum names:	XWC YWC ZWC 		World Coordinates Locus.
		XPP YPP ZPP 		Perspective Projected Locus.
		AA BB CC KK		Face or Edge Coefficients.
		IX IY IZ  		I-unit vector of a frame.
		JX JY JZ  		J-unit vector of a frame.
		KX KY KZ  		K-unit vector of a frame.

	The above datum names all refer to  real numbers.  In GEOMES,
the  datum names are  defined as MEMORY  array references  and so can
appear  on  the  left  of   a  left  arrow.  In  GEOMEL,     eighteen
corresponding  datum  store  routines   are  provided;  for  example:
XWC.(Xvalue,Vertex),  will  store a  new  X coordinate  value  into a
vertex node.

Link names:	NFACE PFACE		Face Ring.
		NED PED 		Edge Ring.
		NVT PVT 		Vertex Ring.
		DAD SON 		Parts Tree Links.
		BRO SIS  		Parts Tree Links.
		ALT ALT2 		GEOMED Temporaries.
		CW CCW			Body ring of world.
		CAR8 CDR8		User Links.

	In both GEOMES and  GEOMEL, the links may be  modified by the
two argument subroutines of the same name with a period "." suffixed
to it; for example, ALT.(Q,E) will place the link (or  integer value)
Q into the ALT halfword link position of the node E.

4.0 	WINGED EDGE PRIMITIVES.

4.1	NODE MAKERS.

<body>	←	MKB(<world or zero>)
<face>	←	MKF(<body>)
<edge>	←	MKE(<body>)
(vertex>←	MKV(<body>)
<frame>	←	MKFRAME;

	MKB makes a body node and place it in the body ring of
the given  world (or in the now world if  the given world argument is
zero). MKF, MKE and MKV make a face, edge or vertex
node respectively and place it in the proper given body's face,  edge
or  vertex ring.   MKFRAME simply  returns a  frame node  with a unit
rotation matrix and zero world locus.

4.2	WING LINK MUNGING.

	WING(<edge1>,<edge2>);
	INVERT(<edge>);
	EVERT(<body>);

	Given that  each edge  has its  proper two  vertices and  two
faces,  WING(E1,E2) will make  the edges point  at each  other in the
correct orientation. INVERT(edge) will flip the linear orientation of
an edge.  EVERT(body) will  flip the surface  orientation of  a body,
making solids into holes and vise versa.

4.3	FACE AND VERTEX PERIMETER ACCESSING.

<next cw edge>	←	ECW(<edge>,<face or vertex>);
<next ccw edge>	←	ECCW(<edge>,<face or vertex>);
<cw vertex>	←	VCW(<edge>,<face>);
<ccw vertex>	←	VCCW(<edge>,<face>);
<cw face>	←	FCW(<edge>,<vertex>);
<ccw face>	←	FCCW(<edge>,<vertex>);
<face or vertex>←	OTHER(<edge>,<face or vertex>);

	ECW(E,FV) and  ECCW(E,FV) fetch  the next  edge clockwise  or
counter clockwise from the given edge about the given face or vertex.
VCW(edge,face) and VCCW(edge,face) fetch the next vertex clockwise or
counter clockwise from the given edge  with repect to the given face.
FCW(edge,vertex)  and FCCW(edge,vertex) fetch the next face clockwise
or counter clockwise  from the  given edge with  repect to the  given
vertex. The OTHER(<edge>,<face|vertex>) will fetch the face or vertex
of the given edge which is not equal to the given face or vertex.

4.3	PARTS TREE AND BODY GET.

		BDET(<body>);
		BATT(<body1>,<body2>);
<body>	←	BGET(<face or edge or vertex>);

	BDET(body) will detach a body from the parts tree.
5.0 	EULER ROUTINES.

BNEW	←	MKBFV;
	←	MKEV
	←	ESPLIT
	←	MKFE
	←	GLUEE

QNEW	←	KLBFEV(Q);
	←	KLFE
	←	KLEV
	←	UNGLUE

	GLUE
	MKCOPY
	SWEEP
	ROTCOM
	PYRAMID
	FVDUAL

BODY	←	MKCUBE(<DX>,<DY>,<DZ>);
BODY	←	MKCYLN(<RADIUS>,<N-SIDES>,<DZ>);
BODY	←	MKBALL(<RADIUS>,<M-LOGITUDES>,<N-LATITUDES>);

	MKCUBE(<x>,<y>,<z>) creates and returns a cubic right prism.
MKCYLN(<r>,<n sides>,<z>) creates and returns a regular N-sided right prism.


<BODY>	←	BIN(<BODY1>,<BODY2>);
<BODY>	←	BUN(<BODY1>,<BODY2>);
<BODY>	←	BSUB(<BODY1>,<BODY2>);
		MKCVEX 

		MKBUCK
		BCUT
		FCUT
		ECUT
6.0	EUCLIDEAN TRANSFORMATIONS.

	OBJECT	←	TRANSL(OBJECT,DX,DY,DZ);
	OBJECT	←	ROTATE(OBJECT,WX,WY,WZ);
	OBJECT	←	SHRINK(OBJECT,SX,SY,SZ);

	TRAN	←	TRANSL(XWD(FRAME,OBJECT),DX,DY,DZ);
	TRAN	←	ROTATE(XWD(FRAME,OBJECT),WX,WY,WZ);
	TRAN	←	SHRINK(XWD(FRAME,OBJECT),SX,SY,SZ);

	OBJECT	←	APTRAN(OBJECT,TRAN);
	FRAME	←	INTRAN(FRAME);

Z	←	DISTANCE(BFEV1,BFEV2);

		NORM
		MKROT1
		ORTHO1(FRAME)
		ORTHO2(FRAME)
Z	←	DETERM(FRAME)
		ANGL3V(V1,V2,V3)
7.0 	IMAGE FORMING ROUTINES.

	GEODPY;				GEOMED's display refresh.
	SHOW1(<WINDOW>,<GLASS>);	Display all edges.
	SHOW2(<WINDOW>,<GLASS>);	Display visible edges only.
	SHOW3(<WINDOW>,<GLASS>);	Display all visible faces.

8.0 	ARITHMETIC AND DISPLAY ROUTINES.

	SQRT LOG SIN COS ATAN ATAN2 ASIN ACOS PI
	DPYSET DPYBIG DPYBRT DPYSST
	AVECT AIVECT RVECT RIVECT DPYOUT

	The usual system arithmetic and display routines used at
Stanford are embedded in GEOMED; so that the typical user should
not require SAITRG or DISPLY or any of their equivalents.
The next paragraph is a short explanation of the display
functions, which are similar to those document in DISPLY.RBN[UP,DOC]@SAIL.

	The CRT display screens are refreshed by a special purpose
display computer which executes a display file from core memory. With the
exception of DPYSET and DPYOUT; all of the diaplay subroutines add
display code to the display file. The display screen has 1024 by 1024
visible addressible positions with the origin in the center of the
screen, the positive X-axis to the right and the positive Y-axis upwards.
Thus display coordinates may range from -512 to +511;